package com.imooc.order.message;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;

/**
 * Created by 廖师兄
 * 2018-02-13 18:17
 */
@Component
@EnableBinding(StreamClient.class)
@Slf4j
public class StreamReceiver {

    @StreamListener(value = StreamClient.OUTPUT)
    @SendTo(StreamClient.OUTPUT2)//把返回值发送给OUTPUT2
    public String process2(String message) {
        log.info("StreamReceiver2: {}", message);
        return "OUTPUT2";
    }

    @StreamListener(value = StreamClient.OUTPUT2)
    public void process22(String message) {
        log.info("StreamReceiver2: {}", message);
    }
}
